<?php

use yii\helpers\Html;
use app\core\lib\ActiveForm;

/* @var $this yii\web\View */
/* @var $model app\models\Product */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="box-body">
    <?php $form = ActiveForm::begin([
        'options' => ['class' => 'form-horizontal'],
        'fieldConfig' => [
            'template' => "{label}\n<div class=\"col-lg-8\">{input}</div>\n<div class=\"col-lg-2\">{error}</div>",
            'labelOptions' => ['class' => 'col-lg-1 control-label'],
        ],
    ]); ?>

    <?= $form->field($model, 'title')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'cid')->dropDownList([0 => '一级菜单'] + \app\models\ProductCate::treeArr(), ['encode' => false]) ?>

    <?= $form->field($model, 'user_id')->textInput() ?>

    <?= $form->field($model, 'cover')->widget(\app\core\widgets\webuploader\WebUploader::className()) ?>

    <?= $form->field($model, 'pics')->widget(\app\core\widgets\webuploader\WebUploader::className(),[
            'clientOptions' => [
                'pick' => [
                    'multiple' => true,
                ],
            ]
    ]) ?>

    <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sort')->textInput() ?>

    <?= $form->field($model, 'views')->textInput() ?>

    <?= $form->field($model, 'num')->textInput() ?>

    <?= $form->field($model, 'price')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'sale_price')->textInput(['maxlength' => true]) ?>

    <?= $form->field($model, 'content')->widget(\yii\redactor\widgets\Redactor::className(), [
        'clientOptions' => [
            'lang' => 'zh_cn',
            'plugins' => ['clips', 'fontcolor', 'imagemanager']
        ]
    ]) ?>

    <?= $form->field($model, 'is_tui')->radioList([0=>'否', 1=>'是']) ?>

    <?= $form->field($model, 'status')->radioList([0=>'無效', 1=>'有效']) ?>

    <?= Html::submitButton(Html::tag('span', '', ['class' => 'glyphicon glyphicon-floppy-disk']) . ' ' .
        ($model->isNewRecord ? 'Create' : 'Save'),
        ['class' => $model->isNewRecord ? 'btn btn-success pull-right' : 'btn btn-primary pull-right']) ?>
    <?php ActiveForm::end(); ?>
</div>
<?php $this->render('@app/modules/admin//views/layouts/modal-form', ['form' => $form]) ?>

